﻿
@{
    ViewData["Title"] = "Edit";
    
     Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>layui在线调试</title>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
      <form class="layui-form" action="/Vehicle/UpdateCarry" lay-filter="example">
        <div class="layui-form-item">
            <div style="float:left">
                <label class="layui-form-label">厂牌型号：</label>
                <div class="layui-input-block">
                    <input type="text" name="Vmodel" id="Vmodel" lay-verify="required" autocomplete="off" placeholder="厂牌型号" class="layui-input">
                </div>
            </div>
             <div style="float:left">
                <label class="layui-form-label">车牌号：</label>
                <div class="layui-input-block">
                    <input type="text" name="Vmark" id="Vmark" lay-verify="required" autocomplete="off" placeholder="车牌号" class="layui-input">
                </div>
            </div>
         </div>
        <div class="layui-form-item">
             <div style="float:left">
                <label class="layui-form-label">司机姓名：</label>
                <div class="layui-input-block">
                    <input type="text" name="Ownername" id="Ownername" lay-verify="required" autocomplete="off" placeholder="司机姓名" class="layui-input">
                </div>
            </div>
             <div style="float:left">
                <label class="layui-form-label">所属公司：</label>
                <div class="layui-input-block">
                    <input type="text" name="Fieldname" id="Fieldname" lay-verify="required" autocomplete="off" placeholder="所属公司" class="layui-input">
                </div>
            </div>
         </div>
        <div class="layui-form-item">
              <div style="float:left">
                <label class="layui-form-label">车长：</label>
                <div class="layui-input-block">
                    <input type="text" name="Vlong" id="Vlong" lay-verify="required" autocomplete="off" placeholder="车长" class="layui-input">
                </div>
            </div>
             <div style="float:left">
                <label class="layui-form-label">车宽：</label>
                <div class="layui-input-block">
                    <input type="text" name="Vwide" id="Vwide" lay-verify="required" autocomplete="off" placeholder="车宽" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div style="float:left">
                <label class="layui-form-label">车高：</label>
                <div class="layui-input-block">
                    <input type="text" name="Vhigh" id="Vhigh" lay-verify="required" autocomplete="off" placeholder="车高" class="layui-input">
                </div>
            </div>
             <div style="float:left">
                <label class="layui-form-label">车辆颜色：</label>
                <div class="layui-input-block">
                    <input type="text" name="Vcolor" id="Vcolor" lay-verify="required" autocomplete="off" placeholder="车辆颜色" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-inline">
                <label class="layui-form-label">购置日期</label>
                <div class="layui-input-inline">
                    <input type="text" name="Vpurchase" id="Vpurchase" lay-verify="required" autocomplete="off" class="layui-input" placeholder="年/月/日">
                </div>
            </div>
             <div style="float:left">
                <label class="layui-form-label">运营证号：</label>
                <div class="layui-input-block">
                    <input type="text" name="Voperation" id="Voperation" lay-verify="required" autocomplete="off" placeholder="运营证号" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
         <br />

            <div style="float:left">
                <label class="layui-form-label">保险到期时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="Vexpire" id="Vexpire" lay-verify="required" autocomplete="off" class="layui-input" placeholder="年/月/日">
                </div>
            </div>
            <div style="float:left">
                <label class="layui-form-label">年检到期时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="Vannual" id="Vannual" lay-verify="required" autocomplete="off" class="layui-input" placeholder="年/月/日">
                </div>
            </div>
        </div>
     <div class="layui-form-item">
         <div style="float:left">
                <label class="layui-form-label">保养公里设置时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="Vmaintain" id="Vmaintain" lay-verify="required" autocomplete="off" class="layui-input" placeholder="年/月/日">
                </div>
            </div>
         </div>
        
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input name="Id" type="text" hidden/>
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary" >重置</button>
                <a class="layui-btn layui-btn-primary" onclick="location.href='/Vehicle/Index'">返回</a>
            </div>
        </div>
    </form>
    <script src="~/libs/jquery/jquery.js"></script>
    <script src="~/layui/layui.js" charset="utf-8"></script>

    <script>
        layui.use(['form', 'layedit', 'laydate','upload'], function(){
          var form = layui.form
          ,layer = layui.layer
          ,layedit = layui.layedit
          ,laydate = layui.laydate
          ,upload = layui.upload
          ,element = layui.element;

          //日期
          laydate.render({
            elem: '#SigningDate'
          });
          form.render();
          //监听提交
          form.on('submit(demo1)', function(data){
          });
          //指定允许上传的文件类型
          //upload.render({
          //  elem: '#test3'
          //  ,url: '/CarryContract/FileUpload' //此处配置你自己的上传接口即可
          //  ,accept: 'file' //普通文件
          //  ,done: function(res){
          //    layer.msg('上传成功');
          //    console.log(res);
          //  }
          //});
          
        });
        $(function(){
            Edit();
            renderTime();
        })
        function renderTime(date) {
        var dateee = new Date(date).toJSON();
        return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
        }
        function Edit(){
            $.ajax({
                url:"/Vehicle/GetCarryById?Id="+@ViewBag.Id,
                type:"get",
                dataType:"json",
                success:function(obj){
                    $("[name=Id]").val(obj.id);
                    $("[name=Vmodel]").val(obj.vmodel);
                    $("[name=Vmark]").val(obj.vmark);
                    $("[name=Ownername]").val(obj.ownername);
                    $("[name=Fieldname]").val(obj.fieldname);
                    $("[name=Vlong]").val(obj.vlong);
                    $("[name=Vwide]").val(obj.vwide);
                    $("[name=Vhigh]").val(obj.vhigh);Vpurchase
                    $("[name=Vcolor]").val(obj.vcolor);
                    $("[name=Vpurchase]").val(obj.vpurchase);
                    $("[name=Voperation]").val(obj.voperation);
                    $("[name=Vexpire]").val(obj.vexpire);
                    $("[name=Vannual]").val(obj.vannual);
                    $("[name=Enclosure]").val(obj.enclosure);
                    $("[name=Vmaintain]").val(obj.vmaintain);
                    //console.log($("[name=Id]").val());
                }
            })
        }
    </script>
</body>
</html>

